/*
 * Copyright 2006-2007 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.sf.jstester.util;

import junit.framework.Assert;
import junit.framework.AssertionFailedError;

/**
 * JUnit 3.x Assert wrapper.<br>
 * Converts all AssertionFailedErrors into JUnitJsAssertionFailedErrors.
 * 
 * @author Andres Almiray <aalmiray@users.sourceforge.net>
 */
public class JUnitAssert implements JsAssert {
   public void assertEquals( boolean expected, boolean actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( byte expected, byte actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( char expected, char actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( double expected, double actual, double delta ) {
      try{
         Assert.assertEquals( expected, actual, delta );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( float expected, float actual, float delta ) {
      try{
         Assert.assertEquals( expected, actual, delta );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( int expected, int actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( long expected, long actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( Object expected, Object actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( short expected, short actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, boolean expected, boolean actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, byte expected, byte actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, char expected, char actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, double expected, double actual, double delta ) {
      try{
         Assert.assertEquals( message, expected, actual, delta );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, float expected, float actual, float delta ) {
      try{
         Assert.assertEquals( message, expected, actual, delta );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, int expected, int actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, long expected, long actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, Object expected, Object actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, short expected, short actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String expected, String actual ) {
      try{
         Assert.assertEquals( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertEquals( String message, String expected, String actual ) {
      try{
         Assert.assertEquals( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertFalse( boolean condition ) {
      try{
         Assert.assertFalse( condition );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertFalse( String message, boolean condition ) {
      try{
         Assert.assertFalse( message, condition );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNotNull( Object object ) {
      try{
         Assert.assertNotNull( object );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNotNull( String message, Object object ) {
      try{
         Assert.assertNotNull( message, object );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNotSame( Object expected, Object actual ) {
      try{
         Assert.assertNotSame( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNotSame( String message, Object expected, Object actual ) {
      try{
         Assert.assertNotSame( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNull( Object object ) {
      try{
         Assert.assertNull( object );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertNull( String message, Object object ) {
      try{
         Assert.assertNull( message, object );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertSame( Object expected, Object actual ) {
      try{
         Assert.assertSame( expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertSame( String message, Object expected, Object actual ) {
      try{
         Assert.assertSame( message, expected, actual );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertTrue( boolean condition ) {
      try{
         Assert.assertTrue( condition );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void assertTrue( String message, boolean condition ) {
      try{
         Assert.assertTrue( message, condition );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void fail() {
      try{
         Assert.fail();
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }

   public void fail( String message ) {
      try{
         Assert.fail( message );
      }catch( AssertionFailedError e ){
         throw new JUnitJsAssertionError( e.getMessage() );
      }
   }
}